<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>valloc</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_010_346">&nbsp;</a>NAME</h4><blockquote>
valloc - page-aligned memory allocator
(<b>LEGACY</b>)
</blockquote><h4><a name = "tag_000_010_347">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="stdlib.h.html">stdlib.h</a>&gt;

void *valloc(size_t <i>size</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_010_348">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>valloc()</i>
function has the same effect as
<i><a href="malloc.html">malloc()</a></i>,
except that the allocated memory will be aligned to a multiple of the
value returned by <i>sysconf</i>(_SC_PAGESIZE).
<p>
This interface need not be reentrant.
</blockquote><h4><a name = "tag_000_010_349">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>valloc()</i>
returns a pointer to the allocated memory.  Otherwise,
<i>valloc()</i>
returns a null pointer and sets
<i>errno</i>
to indicate the error.
<p>
If <i>size</i> is 0, the behaviour is implementation-dependent; the value
returned will be either a null pointer or a unique pointer.  When <i>size</i>
is 0 and
<i>valloc()</i>
returns a null pointer,
<i>errno</i>
is not modified.
</blockquote><h4><a name = "tag_000_010_350">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>valloc()</i>
function will fail if:
<dl compact>

<dt>[ENOMEM]<dd>
Storage space available is insufficient.

</dl>
</blockquote><h4><a name = "tag_000_010_351">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_010_352">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
Applications should avoid using
<i>valloc()</i>
but should use
<i><a href="malloc.html">malloc()</a></i>
or
<i><a href="mmap.html">mmap()</a></i>
instead.  On systems with a large page size, the number of successful
<i>valloc()</i>
operations may be zero.
</blockquote><h4><a name = "tag_000_010_353">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_010_354">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="malloc.html">malloc()</a></i>,
<i><a href="sysconf.html">sysconf()</a></i>,
<i><a href="stdlib.h.html">&lt;stdlib.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
